<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/25
 * Time: 0:12
 */
class GoodsAttribute extends Admin_Controller{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('GoodsAttribute_model');
        $this->load->model('goodstype_model');
    }
    //增
    public function attribute_add(){
        $goods_type = $this->uri->segment(4);
        if($_POST){

        }else{
            $data['goods_type'] = $goods_type;
            $this->load->view('Goods/attribute_add.html',$data);
        }

    }
    //删
    public function attribute_delete(){

    }
    //改
    public function attribute_edit(){

    }
    //查
    public function attribute_list(){
        $goods_type = $this->uri->segment(4);
        $data['goods_type'] = $goods_type;
        $data['attributes'] = $this->GoodsAttribute_model->attribute_list($goods_type);
        foreach($data['attributes'] as $k=>$v){
            if($v['attr_input_type'] == 0){
                $data['attributes'][$k]['attr_input_type_name'] = '手工录入';
            }elseif($v['attr_input_type'] == 1){
                $data['attributes'][$k]['attr_input_type_name'] = '列表中选择';
            }else{
                $data['attributes'][$k]['attr_input_type_name'] = '文本域';
            }
        }
        $data['goods_types'] = $this->goodstype_model->list_goodstype();

        $this->load->view('Goods/attribute_list.html',$data);

    }
}